Background process

A background process is a computer process that runs "behind the scenes" (i.e. in the background) and without user intervention.[1] Typical tasks for these processes include logging, system monitoring, scheduling,[2] and user notification.[3]

On a Unix system, a background process or job can be further identified as one whose group ID differs from its terminal group ID. This type of process is unable to receive keyboard signals from and typically will not send output to its parent terminal.[4] This more technical definition does not distinguish between whether or not the process can receive user intervention.

Although background processes are typically used for purposes requiring few resources, any process can be run in the background, and even though the process is running in the background, where it can't be seen, it behaves like any other process.[1]

Contents

Example

In this example running on Debian GNU/Linux, the sleep utility was launched into the background. Afterward, the ps tool was run in the foreground, where it output the below text. Both were launched from an instance of the bash shell. The TPGID header indicates the foreground process group of the listed process, and the PGID is the process' group ID.[5]

 PPID   PID  PGID   SID TTY      TPGID STAT   UID   TIME COMMAND
...
    1  3537  3537  3537 tty2      1311 Ss       0   0:00 /bin/login --      
 3537   463   463  3537 tty2      1311 R     1000   0:00  \_ -bash
  463  1245  1245  3537 tty2      1311 S     1000   0:00      \_ sleep 300
  463  1311  1311  3537 tty2      1311 R+    1000   0:00      \_ ps axjf
...

Launch & Resumption on Unix

From a Unix command line, a background process can be launched using the "&" operator. The bg utility can resume a suspended job, running it in the background. Using the fg utility will associate a background process with its parent terminal, bringing it into the foreground. The jobs utility will list all processes associated with the current terminal and can be used to bring background processes into the foreground.[4][6]

Daemon

A daemon is a type of background process designed to run continually in the background, waiting for event(s) to occur or condition(s) to be met.[7] These processes typically use minimal system resources and perform tasks which require little to no input from the user. When launched with the daemon function, daemons are disassociated from their parent terminal.[8]

Smartphones

Many newer versions of smartphone & PDA operating systems now include the ability to start background processes. Due to hardware constraints, background processes on mobile operating systems are often restricted to certain tasks or consumption levels. On Android, CPU usage for background processes is bounded at 5 - 10%.[9] Third-party applications on Apple's iOS are limited to a certain set of functions while running in the background.[3] On both iOS and Android, background processes can be killed by the system if they are using too much of the system's memory.[3][9]

See also

References

  1. ^ a b "What is an Operating System?, Processes". The Linux Tutorial. http://www.linux-tutorial.info/modules.php?name=MContent&pageid=3. Retrieved 14 November 2010. 
  2. ^ Michele Cyran (December 1993). Oracle® Database Concepts, 10g Release 1. Oracle Corporation. B10743-01. http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b10743/process.htm. Retrieved 12 November 2010. 
  3. ^ a b c Jesus Diaz (8 April 2010). "How Multitasking Works in the New iPhone OS 4.0". Gizmodo. http://gizmodo.com/5512656/how-multitasking-works-in-the-new-iphone-os-40. Retrieved 14 November 2010. 
  4. ^ a b GNU Bash Reference Manual, Edition 4.1, Job Control Basics. Free Software Foundation, Inc. 23 December 2009. http://www.gnu.org/software/bash/manual/bashref.html#Job-Control. Retrieved 10 November 2010. 
  5. ^ Branko Lankester, Michael Shields (28 July 2004). Linux User's Manual, "ps". http://unixhelp.ed.ac.uk/CGI/man-cgi?ps. Retrieved 10 November 2010. 
  6. ^ Åke Nordlund (7 February 2007). "Background Processes in Unix/Linux". http://www.astro.ku.dk/comp-phys/tutorials/background.shtml. Retrieved 10 November 2010. 
  7. ^ Eric S. Raymond (1 October 2004). The Jargon File, version 4.4.8, "daemon". http://catb.org/~esr/jargon/html/D/daemon.html. Retrieved 10 November 2010. 
  8. ^ raf (12 June 2010). Linux User's Manual, "daemon". http://libslack.org/daemon/manpages/daemon.1.html. Retrieved 10 November 2010. 
  9. ^ a b Matt Buchanan (2010-04-29). "Giz Explains: How Multitasking Works on a Phone". Gizmodo. http://gizmodo.com/5527407/giz-explains-how-multitasking-works-on-a-phone. Retrieved 14 November 2010.